package com.byxm.wlgw.control;

import java.util.List;

import com.byxm.wlgw.bean.GmjlBean;
import com.byxm.wlgw.bean.GmpjBean;
import com.byxm.wlgw.bean.KcxxBean;
import com.byxm.wlgw.bean.SpxxBean;
import com.byxm.wlgw.bean.SpxxtpBean;

import com.byxm.wlgw.service.GmjlService;
import com.byxm.wlgw.service.GmpjService;
import com.byxm.wlgw.service.KcxxService;
import com.byxm.wlgw.service.SpxxService;
import com.byxm.wlgw.service.SpxxtpService;

/**
 * 获取商品信息的Action
 * @author kimxc
 *
 */

public class SpxxAciton extends BaseAction {
	private static final long serialVersionUID = 1L;
	//传过来的值
	private String spxxid=null;
	//返回给前台的单条商品信息
	private SpxxBean spxx=null;
	//库存信息和尺码返回给前台
	private List<KcxxBean> lstkcxx=null;
	
	private List<GmpjBean> lstgmpj=null;
 
    private List<GmjlBean> lstgmjl=null;
 
    private List<SpxxtpBean> lstspxxtp=null;
 

	/**
	 * 获取商品信息
	 * @return
	 */
	public String spxxinfo(){
		SpxxService spxxService=new SpxxService();
		KcxxService kcxxService=new KcxxService();
		GmpjService gmpjService=new GmpjService();
		GmjlService gmjlService=new GmjlService();
		//SpxxtpService spxxtpService= new SpxxtpService();
		//商品信息
		spxx=spxxService.getSpxxByspxxid(Integer.parseInt(spxxid));
		//库存信息以及型号
		lstkcxx=kcxxService.getLstKcxx(Integer.parseInt(spxxid));
		//购买评价
		lstgmpj=gmpjService.getGmpj(Integer.parseInt(spxxid));
		if(lstgmpj==null){
			GmpjBean gmpjBean=new GmpjBean();
			gmpjBean.setEmail("null");
			gmpjBean.setPjnr("暂无评价");
			lstgmpj.add(gmpjBean);
		}
		//购买记录
		lstgmjl=gmjlService.getGmjl();
		if(lstgmjl==null){
			GmjlBean gmjlBean=new GmjlBean();
			gmjlBean.setEmail("null");
			gmjlBean.setGmsl(0);
			lstgmjl.add(gmjlBean);
		}
		//商品信息图片
//		lstspxxtp=spxxtpService.getSpxxtp();
//		if(lstspxxtp==null){
//			SpxxtpBean spxxtpBean= new SpxxtpBean();
//			spxxtpBean.setSpxxtp("图片不存在");
//			lstspxxtp.add(spxxtpBean);
//		}
		return SUCCESS;
	}

	
	/************************setter getter**********************/
	public String getSpxxid() {
		return spxxid;
	}
	public void setSpxxid(String spxxid) {
		this.spxxid = spxxid;
	}
	public SpxxBean getSpxx() {
		return spxx;
	}
	public void setSpxx(SpxxBean spxx) {
		this.spxx = spxx;
	}
	public List<KcxxBean> getLstkcxx() {
		return lstkcxx;
	}
	public void setLstkcxx(List<KcxxBean> lstkcxx) {
		this.lstkcxx = lstkcxx;
	}
	public List<GmpjBean> getLstgmpj() {
		return lstgmpj;
	}
	public void setLstgmpj(List<GmpjBean> lstgmpj) {
		this.lstgmpj = lstgmpj;
	}
	public List<GmjlBean> getLstgmjl() {
		return lstgmjl;
	}
	public void setLstgmjl(List<GmjlBean> lstgmjl) {
		this.lstgmjl = lstgmjl;
	}
	public List<SpxxtpBean> getLstspxxtp() {
		return lstspxxtp;
	}
	public void setLstspxxtp(List<SpxxtpBean> lstspxxtp) {
		this.lstspxxtp = lstspxxtp;
	}
    
}
